#include <iostream>

void select_sort()
{
   int a[] = {2,10,8,3,7,9,5,1,4,6};
   int b[10];
   for(int i=0; i<10; i++) {
       int t = i;
       for(int j=i;j<9;j++) {
           if(a[t]<a[j+1]) {
               //内层循环只记录最小元素的的下标，不做真正的交换，减少交换次数
               t = j+1;
           }
       }
       if(t != i) {
           int tmp = a[i];
           a[i] = a[t];
           a[t] = tmp;
       }
   }

   for(int k=0; k<10; k++) {
       printf("%d ",a[k]);
   }
}

int main() {
    std::cout << "Hello, World!" << std::endl;
    select_sort();
    return 0;
}